/* 工作台页面样式 - 终极修复版 */

.workbench-container {
  display: flex;
  flex-direction: column;
  height: 100vh;
  background-color: #f8f9fa;
  overflow: hidden;
}

/* 顶部导航栏 */
.workbench-header {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  z-index: 1000;
  flex-shrink: 0;
}

.workbench-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
}

.nav-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 2rem;
  height: 60px;
}

.nav-menu {
  display: flex;
  gap: 15px;
  height: 100%;
  align-items: center;
}

/* Logo区域样式 */
.logo-area {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.2rem;
  font-weight: bold;
}

.logo-icon {
  font-size: 1.5rem;
}

.app-title {
  color: #ffffff !important;
  font-weight: 700 !important;
  font-size: 1.2rem;
  letter-spacing: 0.5px;
}

.divider {
  color: rgba(255, 255, 255, 0.3);
  font-size: 1.2rem;
}

.nav-item {
  background: transparent;
  color: rgba(255, 255, 255, 0.9);
  border: none;
  padding: 0 1.2rem;
  height: 40px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 1rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  transition: all 0.2s;
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* 修复：选中状态白底黑字 (响应问题1) */
.nav-item.active {
  color: #333 !important;
  /* 强制深色文字 */
  background: rgba(255, 255, 255, 0.9);
  /* 高亮背景 */
  font-weight: 600;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* === 下拉菜单逻辑 (响应问题3：点击触发) === */
.dropdown {
  position: relative;
  height: auto;
  /* 让容器高度自适应内容 */
  display: inline-flex;
  /* 改为 inline-flex，避免占据整行 */
  align-items: center;
}

.dropdown-menu {
  display: none;
  position: absolute;
  background-color: white;
  border: 1px solid #dee2e6;
  border-radius: 4px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  min-width: 160px;
  z-index: 1001;
  top: 100%;
  /* 紧贴底部 */
  left: 0;
  padding: 5px 0;
  margin-top: 0;
  /* 移除间隙 */
}

.dropdown.open .dropdown-menu {
  display: block;
  animation: fadeIn 0.2s ease;
}

/* 增加一个透明伪元素桥接鼠标路径 */
.dropdown:hover .dropdown-menu {
  display: block;
  animation: fadeIn 0.2s ease;
}

.dropdown-menu::before {
  content: "";
  position: absolute;
  top: -10px;
  left: 0;
  width: 100%;
  height: 10px;
  /* 填补按钮和菜单之间的空隙 */
  background: transparent;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(-5px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.dropdown-item {
  padding: 10px 20px;
  color: #333;
  cursor: pointer;
  display: block;
  text-align: left;
  transition: background 0.2s;
}

.dropdown-item:hover {
  background-color: #f8f9fa;
  color: #667eea;
}

/* 当前案件信息栏 */
.case-info-banner {
  background-color: #fff;
  padding: 0.5rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid #dee2e6;
  font-size: 0.9rem;
  color: #333;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

/* === 标签页系统 (响应问题4：横向排列) === */
.tab-header {
  background: #e9ecef;
  padding: 8px 10px 0 10px;
  border-bottom: 1px solid #ccc;
  display: flex;
  flex-shrink: 0;
  overflow-x: auto;
}

.tab-list {
  display: flex;
  flex-direction: row;
  /* 强制横向 */
  gap: 2px;
}

.tab-item {
  padding: 8px 15px;
  background: #dcdcdc;
  border-radius: 6px 6px 0 0;
  cursor: pointer;
  color: #666;
  border: 1px solid transparent;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 120px;
  justify-content: space-between;
  white-space: nowrap;
  user-select: none;
}

.tab-item:hover {
  background: #e6e6e6;
}

.tab-item.active {
  background: #fff;
  color: #333;
  font-weight: 600;
  border-color: #ccc;
  border-bottom-color: #fff;
  position: relative;
  top: 1px;
}

.tab-close {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
}

.tab-close:hover {
  background: #ff4d4f;
  color: white;
}

.tab-content {
  flex: 1;
  background: white;
  padding: 0;
  overflow: hidden;
  position: relative;
}

.tab-pane {
  display: none;
  width: 100%;
  height: 100%;
  overflow: auto;
  /* 允许内部滚动 */
}

.tab-pane.active {
  display: block;
}

/* 通用按钮样式 (补充) */
.btn-primary {
  background: #667eea;
  color: white;
  border: none;
  padding: 6px 12px;
  border-radius: 4px;
  cursor: pointer;
}

.btn-secondary {
  background: #e9ecef;
  color: #333;
  border: 1px solid #ccc;
  padding: 6px 12px;
  border-radius: 4px;
  cursor: pointer;
}

.btn-success {
  background: #28a745;
  color: white;
  border: none;
  padding: 6px 12px;
  border-radius: 4px;
  cursor: pointer;
}

.btn-cancel {
  background: #fff;
  color: #666;
  border: 1px solid #ccc;
  padding: 6px 12px;
  border-radius: 4px;
  cursor: pointer;
}

/* 数据映射表格样式 */
.mapping-container {
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.table-scroll-area {
  flex: 1;
  overflow: auto;
  padding: 0;
  min-height: 400px;
  height: calc(100vh - 250px);
  max-height: calc(100vh - 250px);
}

.mapping-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 1000px;
}

.mapping-table th {
  min-width: 180px;
  max-width: 300px;
  position: sticky;
  top: 0;
  z-index: 10;
  background: #f1f1f1;
  border: 1px solid #ddd;
  padding: 8px;
}

.mapping-table th div {
  margin-bottom: 5px;
  font-weight: bold;
  color: #333;
  word-break: break-word;
  max-height: 40px;
  overflow: hidden;
}

.mapping-table th select {
  width: 100%;
  padding: 4px;
}

.mapping-table td {
  padding: 6px 8px;
  border: 1px solid #eee;
  max-width: 250px;
  min-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  position: relative;
}

/* 数据查看表格样式 */
.data-display-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.data-display-table th,
.data-display-table td {
  padding: 6px 8px;
  border: 1px solid #eee;
  text-align: left;
  vertical-align: top;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.data-display-table th {
  position: sticky;
  top: 0;
  z-index: 10;
  background: #f1f1f1;
  border: 1px solid #ddd;
  font-weight: 600;
  min-width: 120px;
  max-width: 300px;
}

.data-display-table th:first-child,
.data-display-table td:first-child {
  position: sticky;
  left: 0;
  z-index: 5;
  background: #f9f9f9;
  border: 1px solid #eee;
  text-align: center;
}

.data-display-table td {
  min-width: 120px;
  max-width: 300px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}